<?php

namespace app\api\controller;

use app\common\controller\Api;

/**
 * 省市区接口
 */
class Region extends Api
{

    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    public function _initialize()
    {
        parent::_initialize();
        $this->model = new \app\common\model\Region();
    }



    public function province(){
        $list = $this->model->where(['level' => 1])->select();
        $this->success('',$list);
    }

    public function index(){
        $id = $this->request->request('id');
        $list = $this->model->where(['parent_id' => $id])->cache('__Province__')->select();
        $this->success('',$list);
    }


}